<?php 
/**
 * 商品详细模型   
 */
class DetailModel extends Model{
    public $table = 'detail';
    
    public $validate = array(
		array('intro','nonull','内容不能为空',2,3),
		array('service','nonull','内容不能为空',2,3)
	);
    
    public function addData($gid){
    	//处理商品图册
		//如果有传递图片
		if($pic = Q('post.shopPic')){
			//序列化存入数据库
			//如果读取的时候反序列化读取就可以
			$shopPic = serialize($pic);
			$this->data['good_pic']=$shopPic;
			$this->data['goods_gid']=$gid;
		}
        $this->add();
    }
	
	public function editData($gid){	
    	//处理商品图册
		//如果有传递图片
		if($pic = Q('post.good_pic')){
			//序列化存入数据库
			//如果读取的时候反序列化读取就可以
			$shopPic = serialize($pic);
			$this->data['good_pic']=$shopPic;
			$this->data['goods_gid']=$gid;
		}
        $this->where("goods_gid={$gid}")->update();
		return true;
    }
	
 }
 
 
 
 
 
 
 
 
 
 
 


 ?>